<ui:composition template="../index/index.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:define name="content">
		<h:form>
			<p:fieldset toggleable="true" legend="Edicao de Guias">

				<h:panelGrid columns="2" cellpadding="10">
					
					<h:outputLabel value="Plano de Saude: " />
					<h:selectOneMenu value="#{guiaBean.guia.planoSaude}">
						<f:selectItem itemLabel="Todos" itemValue="" />
						<c:forEach var="plano" items="#{planoSaudeBean.planos}">
							<f:selectItem itemLabel="#{plano.nome}" itemValue="#{plano.id}" />
						</c:forEach>
					</h:selectOneMenu>
					
					<h:outputText value="Data Inicial: " />
					<p:calendar value="#{guiaBean.guia.dataInicial}" />

					<h:outputText value="Data Final: " />
					<p:calendar value="#{guiaBean.guia.dataFinal}" />
					
<!-- 					<h:commandButton action="#{guiaBean.listarFaturas}" value="Procurar Faturas" /> -->
					
				</h:panelGrid>
			</p:fieldset>
	
			<p:fieldset legend="Lista de Faturas" style="margin-top:10px">
					<p:pickList id="pickList" value="#{guiaBean.faturas}"  
				                var="fatura"  
				                itemLabel="#{fatura.planoData}"  
				                itemValue="#{fatura.id}" />  
				  
				    <h:commandButton value="Criar" action="#{guiaBean.save}" />  
					<h:commandButton action="list.xhtml" value="Cancelar" />
					
					<h:inputHidden value="#{guiaBean.guia.id}" />
			</p:fieldset>		
				
		</h:form>
	</ui:define>
</ui:composition>